import java.util.Arrays;

public class Main {

    
    //数组轮转
    public void rotate(int[] nums, int k) {
        int[] temp = new int[nums.length];
        //复制一个数组,取数从这里取
        for (int i = 0; i < nums.length; i++) {
            temp[i] = nums[i];
        }
        int next=0;
        for (int i = 0; i < nums.length; i++) {
            //取余数,i+k可能大于数组长度
            next = (i+k) % nums.length;
            nums[next] = temp[i];
        }
    }


    //用完整的数组减去该数组得出的就是差的那个数字！！！
    public static int missingNumber(int[] nums) {
        int n = nums.length;
        int total = (1 + n) * n / 2;
        int sum = 0;
        for(int i = 0; i < nums.length; i++) {
            sum += nums[i];
        }
        return total - sum;
    }



    void fun(int n) {
        int i = 1;
        while(i <= n)
            i = i * 2;
    }
    public static void main(String[] args) {
        int[] nums = {9,6,4,2,3,5,7,0,1};
        System.out.println(missingNumber(nums));
    }
}